/*
 * Copyright (C) 2021 Baidu, Inc. All Rights Reserved.
 */
package com.chukun.rpc.registry;

import com.chukun.rpc.core.TinyRpcServiceMetaData;

/**
 * <p>注册中心接口<p/>
 *
 * @author chukun
 * @version 1.0
 * @since 1.0-SNAPSHOT
 */
public interface RegistryService {

    /**
     * 注册服务
     * @param metaData
     * @throws Exception
     */
    void register(TinyRpcServiceMetaData metaData) throws Exception;

    /**
     * 销毁服务
     * @param metaData
     * @throws Exception
     */
    void unRegister(TinyRpcServiceMetaData metaData) throws Exception;

    /**
     * 服务发现
     * @param serviceName
     * @param hash
     * @return
     * @throws Exception
     */
    TinyRpcServiceMetaData discovery(String serviceName, int hash) throws Exception;

    /**
     * 销毁注册中心
     */
    void destroy();
}
